Safe and Familiar Multi-core Programming by Means of a Hybrid Functional and Imperative Language
نویسندگان
چکیده
Current (heterogeneous) multi-core environments such as gpGPU architectures are hard to program with normal imperative and object-oriented (OO) languages. There are two basic problems to tackle: (1) it is too easy to program race conditions and dead-locks with the available synchronization primitives, and (2) these environments do not support (or support inefficiently) the instructions required for efficient execution of OO programs, e.g., because function pointers and pointer arithmetic are lacking. We address both problems with a new language that comprises both Functional Programming (FP) and OO programming. We solve problem (1) by auto-parallel ization in the functional core where all loops and non-dependent calls can be executed in parallel. FP is to be used to write computational intensive code in with safe concurrent memory access. An alternative object model that does neither use pointer arithmetic nor function pointers but smart pointers/proxies (to implement polymorphism) as well as mixins and templates (to implement OO like code reuse) solves problem (2). To cleanly integrate the two language cores, we propose a new integration model that even grants some restricted ways to access state from within FP mode. With the new language and prototype compiler we can transparently parallelize code to target both Cuda and multi-core machines (without annotations from the programmer) and obtain good speedups.
منابع مشابه
Closed Types as a Simple Approach to Safe Imperative Multi-stage Programming
Safely adding computational effects to a multi-stage language has been an open problem. In previous work, a closed type constructor was used to provide a safe mechanism for executing dynamically generated code. This paper proposes a general notion of closed type as a simple approach to safely introducing computational effects into multistage languages. We demonstrate this approach formally in a...
متن کاملClosed types for a safe imperative MetaML
This paper addresses the issue of safely combining computational effects and multi-stage programming. We propose a type system, which exploits a notion of closed type, to check statically that an imperative multi-stage program does not cause run-time errors. Our approach is demonstrated formally for a core language called MiniML ref . This core language safely combines multi-stage constructs an...
متن کاملA hybrid DEA-based K-means and invasive weed optimization for facility location problem
In this paper, instead of the classical approach to the multi-criteria location selection problem, a new approach was presented based on selecting a portfolio of locations. First, the indices affecting the selection of maintenance stations were collected. The K-means model was used for clustering the maintenance stations. The optimal number of clusters was calculated through the Silhou...
متن کاملInterpreting XPath by Iterative Pattern Matching with Paisley
The Paisley architecture is a light-weight EDSL for non-deterministic pattern matching. It automates the querying of arbitrary objectoriented data models in a general-purpose programming language, using API, libraries and simple programming patterns in a portable and noninvasive way. The core of Paisley has been applied to real-world applications. Here we discuss the extension of Paisley by pat...
متن کاملOn the Benefits of Combining Functional and Imperative Programming for Multicore Software An Empirical Study Comparing Scala and Java
Recent multi-paradigm programming languages combine functional and imperative programming styles to make software development easier. Given today’s proliferation of multicore processors, parallel programmers are supposed to benefit from this combination, as many difficult problems can be expressed more easily in a functional style while others match an imperative style. However, due to a lack o...
متن کامل